# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=ruby-ae
pkgver=1.8.2
pkgrel=2
pkgdesc='Assertive Expressive is an assertions library specifically designed for reuse by other test frameworks'
arch=(any)
url='https://github.com/rubyworks/ae'
license=(BSD custom)
depends=(ruby)
checkdepends=(ruby-qed)
options=(!emptydirs)
source=(https://github.com/rubyworks/ae/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('3467a71b1b1e0c10d5e7d05eaa1ee90d120761f68d54d484d7ea7452faacf290')

build() {
  local _gemdir="$(gem env gemdir)"
  cd ae-$pkgver
  gem build .gemspec
  gem install \
    --local \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "tmp_install/$_gemdir" \
    --bindir "tmp_install/usr/bin" \
    ae-$pkgver.gem
  find "tmp_install/$_gemdir/gems/" \
    -type f \
    \( \
        -iname "*.o" -o \
        -iname "*.c" -o \
        -iname "*.so" -o \
        -iname "*.time" -o \
        -iname "gem.build_complete" -o \
        -iname "Makefile" \
    \) \
    -delete
  rm -r tmp_install/$_gemdir/cache
}

check() {
  local _gemdir="$(gem env gemdir)"
  cd ae-$pkgver
  GEM_HOME="tmp_install/$_gemdir" qed
}

package() {
  cd ae-$pkgver
  cp -a tmp_install/* "$pkgdir"/
  install -Dm644 NOTICE.md -t "$pkgdir"/usr/share/licenses/$pkgname/
}
